$(function () {

    $("body").css("opacity","1")

    $("#tijiao").click(function () {
        console.log(1);
        $(this).css({"background-color": "#007dd2", "color": "white"})
        $("#jgchaxun").css({"background-color": "white", "color": "black"})
        $("#tijiao1").show(500)
        $("#jgchaxun1").hide(500)
    });

    $("#jgchaxun").click(function () {
        console.log(1);
        $(this).css({"background-color": "#007dd2", "color": "white"})
        $("#tijiao").css({"background-color": "white", "color": "black"})
        $("#jgchaxun1").show(500)
        $("#tijiao1").hide(500)
    });


    var username = localStorage.getItem("username");
    $.post("/xjxt/biyeshenghe?username="+ username +"",function(res){

        var hehe = JSON.parse(res);
        console.log(hehe);
        $("#name12").val(hehe[0].name);
        $("#username").val(hehe[0].username);

    });

   

    $.post("/xjxt/shejichaxun?username="+ username +"",function(res){

        var hehe = JSON.parse(res);
        console.log(hehe);

        //动态的创建一个table，同时将后台获取的数据动态的填充到相应的单元格
        $("#sjchaxun").append("<tr>"+ "<td>" + "姓名" +"</td>" +  "<td>" + "说明" +"</td>" +"<td>" + "下载"+"</td>" +"<td>" + "建议" +"</td>"+"<td>"+"结果" +"</td>"+"</tr>");
        $.each(hehe, function (colIndex, col) {


            if (col.jieguo == "0")
            {col.gaibian = "尚未处理"}

            if (col.jieguo == "2")
            {col.gaibian = "论文/设计不通过"}

            if (col.jieguo == "1")
            {col.gaibian = "论文/设计通过"}

            var th;
            th+="<td>" + col.name+"</td>" +"<td>" + col.shuoming+"</td>" + "<td>" + "<a href=http://localhost:8080/xjxt/sheji/"+col.dizhi+" download="+col.dizhi+">" + col.dizhi +"</a>" + "</td>" + "<td>" +col.jianyi+"</td>" + "<td>" +col.gaibian+"</td>";
            $("#sjchaxun").append("<tr>" + th + "</tr>");


        });
    });

});